const arr1 = [1, 2, 3];
const arr2 = [...arr1, 10, 20, 30];
// console.log(arr2)//[ 1, 2, 3, 10, 20, 30 ]

const obj1 = {
    a: 1,
    b: 2,
    c: 3
}

const obj2 = {
    ...obj1,
    d: 4,
    e: 5,
    f: 6
}
// console.log(obj2)//{ a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 }

const props = {
    size: 1,
    src: 'xxxx',
    mode: 'si'
}


const {
    size,
    ...others
} = props;

// console.log(others)//{ src: 'xxxx', mode: 'si' }

const add = (a, b, ...more) => {
    return more.reduce((m, n) => m + n) + a + b
}
// console.log(add(1, 23, 1, 2, 3, 4, 5))


var fn = function (num) {
    return new Promise(function (resolve, reject) {
        if (typeof num == 'number') {
            resolve(num);
        } else {
            reject('TypeError');
        }
    })
}

fn(2).then(function (num) {
        console.log('first: ' + num);
        return num + 1;
    })
    .then(function (num) {
        console.log('second: ' + num);
        return num + 1;
    })
    .then(function (num) {
        console.log('third: ' + num);
        return num + 1;
    });

// 输出结果first: 2 second: 3 third: 4

